<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		//$order=pdo_get('jy_weishop_order',array('id'=>5122));
		//model('jy_newcar/commission')->create($order);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_newcar/index/'),
		array('title'=>'卖车合伙人','icon'=>'icon-dingdan','action'=>'jy_newcar/mai.index/'),
		array('title'=>'卖车推广组','icon'=>'icon-yiban','action'=>'jy_newcar/mai.tuilog/'),
		array('title'=>'我的团队','icon'=>'icon-paihao0','action'=>'jy_newcar/mai.down/'),
	);	
	$return['item']=$this->plugin_setting('basic');
	$return['item']['mfooternav']=$return['item']['mfooternav']?:$footernav;
	$aitip='启用后才生效！';
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>$aitip),
					//array('type'=>'switch','title'=>'是否启用？','name'=>'m_open'),
					array('type'=>'radio','title'=>'成为卖车合伙人条件','name'=>'m_become','options'=>'become','help'=>''),
					array('type'=>'link','from'=>'action','title'=>'二维码跳转链接','name'=>'share_link','help'=>'默认跳转到商城首页，指定链接后，跳转到指定页面！'),
				)
			),
			array(
				'title'=>'合伙人设置',
				'list'=>array(
					array('type'=>'tip','title'=>'[温馨提示]：如何直推是购车合伙人，优先购车合伙人奖励，这时卖车合伙人没有奖励产生！'),
					//array('type'=>'radio','title'=>'合伙人必须完善资料','name'=>'become_reg','options'=>'is'),
					array('type'=>'array','name'=>'fee_set1','title'=>'推广奖励','add_tip'=>'添加一个推广奖励',
						'list'=>array(
							array('type'=>'unitstring','unit'=>'元','name'=>'fee','title'=>'循环奖N元'),							
						),
						'details'=>array(
							array('type'=>'unitstring','unit'=>'元','name'=>'fee','title'=>'循环奖N元'),		
						),
						'help'=>'按照循环方案，每3台车为1组，获得卖车【推广奖励】；'
					),
					array('type'=>'title','title'=>'卖车分期奖励'),
					array('type'=>'tip','title'=>'
					3.1、三台车指导价总和×0.8÷3台车=所得总奖励：(29.98+25.98+21.98万）÷3台车=207840元；
					</br>3.2、所得总奖励-已支付奖励=剩余奖励：207840元-3台车60000元=147840元；
					</br>3.3、剩余奖励÷剩余期数=每月奖励（按月支付）：147840元÷24期=6160元；
					</br>说明：3台车为1组，只要在第36个月内卖出第3台车【都以成功提车为标准】，才一次性产生（可结算）【卖车分期奖励】，第3台车按24个月奖励【卖车分期奖励】；如果超过36个月，那么又从第1台车奖励开始计算；
					'),
					array('type'=>'switch','title'=>'是否启用卖车分期奖励？','name'=>'isfee2','isradio'=>1),
					array('type'=>'title','title'=>'直推经销商代理收益'),
					array('type'=>'switch','title'=>'是否启用？','name'=>'isfee3','isradio'=>1),
					array('type'=>'unitstring','unit'=>'%','name'=>'fee3rate','title'=>'直招经销商代理收益'),		
				)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
								array('type'=>'array','name'=>'mfooternav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['become']=array('0'=>'无条件','1'=>'人工审核');
	$return['leveltype']=$this->level_up_types;
	$return['otherfee_types']=$this->model('model')->otherfee_types();
	$return['withdraw']=$this->pay_types;
	$return['commissiontype']=$this->commission_types;
	$return['is']=array('0'=>'否','1'=>'是');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['levelfee_type']=$this->levelfee_type;
	$return['pay_type']=get_pay_types();
	$return['htmls']=$htmls;
	exi($return);
}